package com.coder.books.thinkinjava.io;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.RandomAccessFile;

/**
 *
 * @author yuhushuan
 * @date 2020/9/30 21:25
 */
class TestRandomAccessFile {

    private static void write(String fileName) {
        try {
            RandomAccessFile writer = new RandomAccessFile(fileName, "rw");
            writer.writeBytes("这是TestRandomAccessFile 写入的文件");
            writer.close();
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    private static void writeAndRead() {
        File file = new File("RandomAccessFile");
    }


    public static void main(String[] args) {
        write(DirList.IO_PATH + "raf.txt");
    }
}
